-- 创建test22数据库
CREATE DATABASE test22
ON PRIMARY
(
    NAME = test22_data,
    FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\test22_data.mdf',
    SIZE = 10MB,
    MAXSIZE = 50MB,
    FILEGROWTH = 5MB
)
LOG ON
(
    NAME = test22_log,
    FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\test22_log.ldf',
    SIZE = 5MB,
    MAXSIZE = 25MB,
    FILEGROWTH = 5MB
);
GO

-- 使用test22数据库
USE test22;
GO

-- 创建student表
CREATE TABLE student
(
    sid INT IDENTITY(1,1) PRIMARY KEY,  -- 自增主键
    sname VARCHAR(50) NOT NULL,         -- 学生姓名，非空
    age INT                             -- 学生年龄
);
GO

-- 查看表结构确认
EXEC sp_help 'student';
    